package com.example.demo.controller;

import com.example.demo.mapper.UserMapper;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-06-04
 * Time: 20:10
 */
@RequestMapping("/test")
@RestController
public class TestController {

    @Autowired
    private UserService userService;

    @RequestMapping("/a")
    public int a() {
        return 2;
    }

    @RequestMapping("b")
    public String b() {
        return "Spring";
    }

    @RequestMapping("/del")
    @Transactional
    public int del() throws InterruptedException {
        int result = userService.del(1);
        System.out.println("删除 : " + result);
        return result;
    }
}
